﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace array
{
    class Program
    {
        static void Main(string[] args)
        {
            //二维数组
            double[,] points = { { 90, 80 }, { 100, 89 }, { 88.5, 86 } };
            for (int i=0;i<points.GetLength(0);i++)
            {
                Console.WriteLine("第" + (i + 1) + "个学生成绩：");
                for(int j = 0; j < points.GetLength(1); j++)
                {
                    Console.WriteLine( points [i ,j]+" ");
                }
                Console.WriteLine();
            }
          
            //扩展方法
            string[] strArray = { "aaaa", "bbbb", "ccc", "ddd" };
            strArray.PrintArrayInfo();

            // foreach 循环
            string str = "阿里,腾讯,万达,龙湖,万科";
          foreach(var item in str)
            {
                Console.WriteLine(item  );
            }

            //Split 将字符串拆分为数组

            string arr = "华为,锤子，vivo,oppo,魅族，小米";
            var firstArray = arr .Split('华','锤','v','o','魅');
            firstArray.PrintArrayInfo();
            Console.WriteLine();
            double[] pointss = { 88, 90, 35, 54, 79.3 };
            double sum = 0;
            double avg = 0;
            foreach(double poin in pointss)
            {
                sum += poin;
                Console.WriteLine(poin );

            }
        
            avg = sum / pointss.Length;
            Console.WriteLine("总成绩为："+sum );
            Console.WriteLine("平均成绩为："+avg );
          
        }
    }
}
